import Vue from 'vue'
import Vuex from 'vuex'

import {getUrlInfo} from "@/api/user";

Vue.use(Vuex)
export default {
    state: {
        server_url: '',
    },
    mutations: {
        SET_SERVER_URL: (state, server_url) => {
            state.server_url = server_url
        }
    },
    actions: {
        getUrl({commit}, state) {
            getUrlInfo().then(res => {
                const url = res.data.url + ':' + res.data.port
                commit("SET_SERVER_URL", url)
            })
        }
    }
}
